package de.fhkoeln.avs.parallelbreadthfirstsearch.infinitegraph.mockup;

import de.fhkoeln.avs.graphbuild.infinitegraph.storage.AvsVertex;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;


public class RAMPersistentVertex implements AvsVertex{

	private HashMap<String,AvsVertex> childs = new HashMap<String,AvsVertex>();
	
	private String name;

	private String owner;
	
	public List<AvsVertex> getChilds() {
		List<AvsVertex> childList = new ArrayList<AvsVertex>();
		childList.addAll(childs.values());
		return childList;
	}

	public void setChilds(List<AvsVertex> childs) {
		for(AvsVertex child : childs){
			this.childs.put(child.getName(), child);
		}
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getOwner() {
		return owner;
	}

	public void setOwner(String owner) {
		this.owner = owner;
	}

	@Override
	public void addChild(AvsVertex child) {
		if(childs.get(child.getName()) == null)
			this.childs.put(child.getName(), child);
	}
	
	
}
